﻿@using CJAtech.BBS.DataEntity;
@using CJAtech.BBS.Web.Controllers;
@model ArticleResultInfo
@{
    var objUserInfo = HttpContext.Current.GetItems("UserInfo") as UserInfo;
}
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
    <meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no,minimal-ui" name="viewport">
    <meta content="telephone=no" name="format-detection">
    <meta content="yes" name="apple-mobile-web-app-capable">
    <title>@Model.ArticleInfo.ArticleTitle</title>
    <link rel="stylesheet" href="/content/resources/bbs/css/reset.css?ver=201504151736">
    <link rel="stylesheet" href="/content/resources/bbs/css/basic.css?ver=201504151736">
    <link rel="stylesheet" href="/content/resources/bbs/css/comm.css?ver=201504151736">
    <style type="text/css">
        img#detail-img {
            width: 200px !important;
            height: 266px !important;
            position: static !important;
        }

        .topicList {
            padding: 0;
        }

        .replylist {
            margin: 10px;
        }
    </style>
</head>
<body id="page-detail">
    <div class="container">
        <div id="allThreadList" scrollpagination="disabled">
            <div class="club_page_2">
                <div class="topicBox">
                    <div class="topicCon pd15">
                        <p class="personImgDate">
                            <span class="perImg db">
                                @*<a href="/club/user/1000000">
                                    <img width="38" height="38" class="postUserAvatar1000000 bImg" src="http://dev.www.idengpao.com/upload/face/1000000s.jpg" style="display: block;">
                                </a>*@
                                <i class=""></i>
                                <span class="timeT">@Model.ArticleInfo.ArticleTitle<i><em class="inblk mright10">作者：@Model.ArticleInfo.ArticleAuthor </em><em>发布时间：@Model.ArticleInfo.CreateDate.ToString("yyyy-MM-dd HH:mm") </em></i></span>
                                <span class="locationCon db locB"><i class="locInco commF"></i>上海市杨浦区黄兴路</span>
                            </span>
                            <span class="perDate db" style="display:none;">
                                <a class="PerPopBtn incoA db" tid="635" href="javascript:;"></a>
                            </span>
                            <span style="display: none" tid="635" class="perPop">
                                <a href="javascript:;" class="perBCon db banThread">标记为广告</a>
                            </span>
                        </p>
                        <div class="detailCon">
                            <p class="ad"></p>
                            <p class="contentbox contenttext">
                                @Html.Raw(Model.ArticleContent)
                            </p>
                        </div>
                        <div class="cfix">
                            <span class="replyShare db fr">
                                <!--<a class="like" data-praised="0" href="javascript:;" data-pid="12" data-uid="1000000" data-uname="Capricair"><i class="noPraise"></i><span class="num">0</span></a>-->
                                <a class="threadReply detailComment" href="javascript:;" data-pid="@Model.ArticleInfo.ArticleId" data-uid="1000000" data-username="Capricair" data-reply="0"><i class="incoR spr"></i><span class="num">6</span></a>
                            </span>
                        </div>
                    </div>
                    <div class="sort">
                        <ul id="sortlist">
                            <li data-action="all" class="on"><a href="javascript:;" class="sortitem">最新评论</a></li>
                            <li data-action="hot"><a href="javascript:;" class="sortitem">最热评论</a></li>
                        </ul>
                    </div>
                    <div class="replyBox topicList noPerImg">
                        <div id="notify" class="notify txtc hide">有新评论啦</div>
                        <ul id="commentList" class="replylist">
                            @*@Html.Action("CommentList", new { id = Model.ArticleId })*@
                        </ul>
                    </div>
                </div>
            </div>
        </div>
        <a id="more_comment" class="button mbottom10" href="javascript:;" style="display:none;" data-action="all">更多评论</a>
        <div data-max="0" id="loadNext" data-page="3" class="loading" style="display: none;"></div>
    </div>
    <div id="divCommentInfo" style="display:none;">
        <li id="comment{CommentID}" data-cid="{CommentID}" data-action="unbind">
            <span>
                <a href="javascript:void(0)" class="threadReply" data-pid="{ArticleID}" data-uid="{UserID}" data-username="{UserName}">{UserName}</a>：
            </span>
            <span class="comcon">{Content}</span><div class="txtr mtop10">
                <a class="like mright20" data-praised="0" href="javascript:;" data-pid="{ArticleID}" data-uid="{UserID}" data-uname="{UserName}">
                    <i class="noPraise"></i><span class="num">0</span>
                </a>
                <a class="threadReply detailComment" data-reply="1" data-username="{UserName}" data-uid="{UserID}" data-pid="{ArticleID}" href="javascript:;">
                    <i class="incoR spr"></i><span class="num">6</span>
                </a>
            </div>
        </li>
    </div>
    <input type="hidden" value="@objUserInfo.UserId" id="hidCurrentUserID" name="BottomOperation$hidCurrentUserID">
    <input type="hidden" value="@objUserInfo.UserName" id="hidCurrentUserName" name="BottomOperation$hidCurrentUserName">
    <input type="hidden" value="@Model.ArticleInfo.ArticleId" id="hidArticleId" />
    <script src="/content/resources/bbs/js/jquery-1.10.2.min.js" type="text/javascript"></script>
    <script src="/content/resources/bbs/js/fastclick.js" type="text/javascript"></script>
    <script src="/content/resources/bbs/js/idangerous.swiper-2.7.min.js" type="text/javascript"></script>
    <script src="/content/resources/bbs/js/scrollpagination.js" type="text/javascript"></script>
    <script src="/content/resources/bbs/js/imagesloaded-3.1.4.min.js" type="text/javascript"></script>
    <script src="/content/resources/bbs/js/iutility-1.0.src.js?ver=201504151736" type="text/javascript"></script>
    <script src="/content/resources/bbs/js/action.js?ver=201504151736" type="text/javascript"></script>
    <script src="/content/resources/bbs/js/script.js?ver=201504151736" type="text/javascript"></script>
    <script type="text/javascript">
        var PageIndex = 1;
        $(function () {
            //加载评论
            getLatestComment();
            ////处理表情
            //replaceCommentEmotion($("#commentList li"));
            //处理@标签
            $("#commentList li").each(formatAtSign);
            //更多评论
            $("#more_comment").click(function () {
                var _this = $(this);
                var action = _this.attr("data-action");
                if (action == "hot") {
                    getHotCommentList();
                } else {
                    getAllCommentList();
                }
            })
            //获取最新评论
            function getAllCommentList() {
                var commentID = $("#commentList li:last").attr("data-cid");
                getHistoryComment(commentID, function (data) {
                    if (data == "" || typeof (data) == "undefined") {
                        $("#more_comment").hide();
                    }
                });
            }
            //获取最热评论
            function getHotCommentList(callback) {
                var articleID = $("#hidArticleId").val();
                PageIndex++;
                getHotComment(PageIndex, function (data) {
                    if (data == "" || typeof (data) == "undefined") {
                        $("#more_comment").hide();
                    }
                    if (typeof (callback) == "function") {
                        callback();
                    }
                });
            }
            ////点赞
            //$(".like .noPraise").parents(".like").click(praise);
            //评论icon点击
            $(".threadReply").click(openReplyForm);
            //新评论轮询
            startRollPolling();
            //新评论提醒点击
            $("#notify").click(function () {
                var commentID = $("#commentList li:first").attr("data-cid");
                getLatestComment(commentID, function () {
                    $("#notify").hide();
                    startRollPolling();
                });
            });
            //最新评论点击事件
            $("#sortlist li[data-action='all']").click(function () {
                var _this = $(this);
                if ($("#sortlist li.on").attr("data-action") == "all") return;//如果点击相同排序阻止操作
                $("#commentList").height($("#commentList").height());//让评论列表保持高度，防止屏幕上下抖动
                $("#commentList").empty();//清空评论列表
                if (typeof (ClubAction.IntervalID) == "undefined") {
                    startRollPolling();//开启轮询
                }
                $("#more_comment").attr("data-action", "all");//更多评论改为获取更多最新评论
                $("#sortlist li.on").removeClass("on");
                _this.addClass("on");
                //获取最新评论第一页
                getLatestComment(null, function () {
                    $("#commentList").css("height", "auto");
                });
            });
            //最热评论点击事件
            $("#sortlist li[data-action='hot']").click(function () {
                var _this = $(this);
                if ($("#sortlist li.on").attr("data-action") == "hot") return;//如果点击相同排序阻止操作
                $("#commentList").height($("#commentList").height());//让评论列表保持高度，防止屏幕上下抖动
                $("#commentList").empty();//清空评论列表
                $("#notify").hide();//隐藏最新评论提醒

                closeRollPolling();//停止轮询

                $("#more_comment").attr("data-action", "hot");//更多评论改为获取更多最热评论
                $("#sortlist li.on").removeClass("on");
                _this.addClass("on");
                //获取最热评论第一页
                PageIndex = 0;
                getHotCommentList(function () {
                    $("#commentList").css("height", "auto");
                });
            });
        });
    </script>
</body>
</html>